package com.hnkywl.sts.entity.organ;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.base.Fj;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.htgl.Htdy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: 朱强
 * Date: 13-4-7
 * Time: 下午8:38
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_SYS_LJ")
@Where(clause = "deleted!='1'")
public class Lj extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqLj", allocationSize = 1, sequenceName = "SEQ_SYS_LJ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqLj")
    private Long id;

    /**
     * 名称
     */
    private String mc;

    /**
     * 路径简称
     */
    private String ljjc;

    /**
     * 经营机构
     */
    @ManyToOne
    @JoinColumn(name = "jyjg_id")
    @Where(clause = "deleted!='1'")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jyjg;

    /**
     * 上游供应商
     */
    @ManyToMany(targetEntity = Gsjg.class, fetch = FetchType.LAZY)
    @JoinTable(
            name = "T_LJ_SY",
            joinColumns = @JoinColumn(name = "LJ_ID"),
            inverseJoinColumns = @JoinColumn(name = "SY_ID")
    )
    private List<Gsjg> sy;

    /**
     * 下游客户
     */
    @ManyToMany(targetEntity = Gsjg.class, fetch = FetchType.LAZY)
    @JoinTable(
            name = "T_LJ_XY",
            joinColumns = @JoinColumn(name = "LJ_ID"),
            inverseJoinColumns = @JoinColumn(name = "XY_ID")
    )
    private List<Gsjg> xy;

    /**
     * 供应站
     */
    @ManyToOne
    @JoinColumn(name = "GYZ_ID")
    private Nbbm gyz;

    /**
     * 利率
     * 精度为5
     */
    @Column(name = "ll", precision = 5)
    private Double ll = 0.0d;

    /**
     * 付款方式
     */
    private String fkfs;

    /**
     * 回款方式
     */
    private String hkfs;

    /**
     * 计算依据
     */
    @ManyToOne
    @JoinColumn(name = "jsfs_id")
    private Sjzdz jsfs;

    /**
     * 回款期
     */
    private String hkq;

    /**
     * 可修改
     */
    private boolean kxg;

    /**
     * 解冻/冻结
     */
    private boolean sfdj;

    /**
     * 是否可建协议
     */
    private boolean sfkjxy;

    /**
     * 经营品种
     */
    private String jypz;

    /**
     * 担保方式
     */
    private String dbfs;

    /**
     * 数量
     */
    private Integer sl;

    /**
     * 路径附件
     */
    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, targetEntity = Fj.class)
    @JoinColumn(name = "LJ_ID")
    private List<Fj> fjList;

    /**
     * 销售合同模板
     */
    @ManyToOne
    @JoinColumn(name = "XSHTMB_ID")
    private Htdy xshtmb;

    /**
     * 采购合同模板
     */
    @ManyToOne
    @JoinColumn(name = "CGHTMB_ID")
    private Htdy cghtmb;

    /**
     * 流程状态
     */
    private String zt;

    /**
     * 关联流程
     */
    @Basic
    @Column(name = "LC_ID")
    private String processInstanceId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMc() {
        return mc;
    }

    public void setMc(String mc) {
        this.mc = mc;
    }

    public String getLjjc() {
        return ljjc;
    }

    public void setLjjc(String ljjc) {
        this.ljjc = ljjc;
    }

    public Gsjg getJyjg() {
        return jyjg;
    }

    public void setJyjg(Gsjg jyjg) {
        this.jyjg = jyjg;
    }

    public List<Gsjg> getSy() {
        return sy;
    }

    public void setSy(List<Gsjg> sy) {
        this.sy = sy;
    }

    public List<Gsjg> getXy() {
        return xy;
    }

    public void setXy(List<Gsjg> xy) {
        this.xy = xy;
    }

    public Double getLl() {
        return ll;
    }

    public void setLl(Double ll) {
        this.ll = ll;
    }

    public Sjzdz getJsfs() {
        return jsfs;
    }

    public void setJsfs(Sjzdz jsfs) {
        this.jsfs = jsfs;
    }

    public String getHkq() {
        return hkq;
    }

    public void setHkq(String hkq) {
        this.hkq = hkq;
    }

    public boolean isKxg() {
        return kxg;
    }

    public boolean isSfdj() {
        return sfdj;
    }

    public void setSfdj(boolean sfdj) {
        this.sfdj = sfdj;
    }

    public String getJypz() {
        return jypz;
    }

    public void setJypz(String jypz) {
        this.jypz = jypz;
    }

    public List<Fj> getFjList() {
        return fjList;
    }

    public void setFjList(List<Fj> fjList) {
        this.fjList = fjList;
    }

    public void setFkfs(String fkfs) {
        this.fkfs = fkfs;
    }

    public void setHkfs(String hkfs) {
        this.hkfs = hkfs;
    }

    public boolean isSfkjxy() {
        return sfkjxy;
    }

    public void setSfkjxy(boolean sfkjxy) {
        this.sfkjxy = sfkjxy;
    }

    public String getDbfs() {
        return dbfs;
    }

    public void setDbfs(String dbfs) {
        this.dbfs = dbfs;
    }

    public Integer getSl() {
        return sl;
    }

    public void setSl(Integer sl) {
        this.sl = sl;
    }

    public void setKxg(boolean kxg) {
        this.kxg = kxg;
    }

    public Nbbm getGyz() {
        return gyz;
    }

    public void setGyz(Nbbm gyz) {
        this.gyz = gyz;
    }

    public Htdy getXshtmb() {
        return xshtmb;
    }

    public void setXshtmb(Htdy xshtmb) {
        this.xshtmb = xshtmb;
    }

    public Htdy getCghtmb() {
        return cghtmb;
    }

    public void setCghtmb(Htdy cghtmb) {
        this.cghtmb = cghtmb;
    }

    /**
     * 0、金融,1、供应商 2、客户 3、保供 4、库存零售
     */
    private Integer lx;

    public Integer getLx() {
        return lx;
    }

    public void setLx(Integer lx) {
        this.lx = lx;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public String getFkfs() {
        return fkfs;
    }

    public String getHkfs() {
        return hkfs;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }


}
